<html>
<head>
<title>Docs for page session.lib.php</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">Session_library</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
        
                                                                                                                    
                                                                      		  [ <a href="../classtrees_Session_library.html" class="menu">class tree: Session_library</a> ]
		  [ <a href="../elementindex_Session_library.html" class="menu">index: Session_library</a> ]
		  	    [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
      <b>Packages:</b><br />
              <a href="../li_default.html">default</a><br />
              <a href="../li_Database.html">Database</a><br />
              <a href="../li_Game_library.html">Game_library</a><br />
              <a href="../li_Main.html">Main</a><br />
              <a href="../li_Session_library.html">Session_library</a><br />
              <a href="../li_Table_library.html">Table_library</a><br />
              <a href="../li_User_library.html">User_library</a><br />
            <br /><br />
                        <b>Files:</b><br />
      	  <div class="package">
			<a href="../Session_library/_lib---session.lib.php.html">		session.lib.php
		</a><br>
	  </div><br />
      
      
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1>Procedural File: session.lib.php</h1>
Source Location: /lib/session.lib.php<br /><br />

<br>
<br>


<h2>Page Details:</h2>
This file holds the library functions for user session management.<br /><br /><br /><br />
<h4>Includes:</h4>
<div class="tags">
require_once(<a href="../Database/_lib---db.lib.php.html">"lib/db.lib.php"</a>) [line 10]<br />
require_once(<a href="../default/_conf---site.conf.php.html">"conf/site.conf.php"</a>) [line 11]<br />
</div>
<br /><br />
<br /><br />
<br />
  <hr />
	<a name="functionsession_clear_expired"></a>
	<h3>session_clear_expired <span class="smalllinenumber">[line 202]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>int session_clear_expired(
)</code>
    </td></tr></table>
    </td></tr></table><br />

		Delete expired session in database.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td>Number of records deleted.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>
  <hr />
	<a name="functionsession_gen_id"></a>
	<h3>session_gen_id <span class="smalllinenumber">[line 48]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>string session_gen_id(
)</code>
    </td></tr></table>
    </td></tr></table><br />

		Generate a unique session key.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td>Session key.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>
  <hr />
	<a name="functionsession_get_user_id"></a>
	<h3>session_get_user_id <span class="smalllinenumber">[line 225]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>int|FALSE session_get_user_id(
string $session_id, [bool $no_escape = FALSE])</code>
    </td></tr></table>
    </td></tr></table><br />

		Get the user ID of a session.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td><strong>User ID</strong> of session, <strong>FALSE</strong> if failed.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    		<h4>Parameters</h4>
    <table border="0" cellspacing="0" cellpadding="0">
		      <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$session_id</b>&nbsp;&nbsp;</td>
        <td>ID of session in question.</td>
      </tr>
		      <tr>
        <td class="type">bool&nbsp;&nbsp;</td>
        <td><b>$no_escape</b>&nbsp;&nbsp;</td>
        <td>Indicate whether to escape the variables or not.</td>
      </tr>
				</table>
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>
  <hr />
	<a name="functionsession_id_is_exist"></a>
	<h3>session_id_is_exist <span class="smalllinenumber">[line 21]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>bool session_id_is_exist(
string $session_id, [bool $no_escape = FALSE])</code>
    </td></tr></table>
    </td></tr></table><br />

		Check whether a session ID exists.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td><strong>TRUE</strong> if exists, <strong>FALSE</strong> if not.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    		<h4>Parameters</h4>
    <table border="0" cellspacing="0" cellpadding="0">
		      <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$session_id</b>&nbsp;&nbsp;</td>
        <td>Session ID in question.</td>
      </tr>
		      <tr>
        <td class="type">bool&nbsp;&nbsp;</td>
        <td><b>$no_escape</b>&nbsp;&nbsp;</td>
        <td>Indicate whether to escape the variables or not.</td>
      </tr>
				</table>
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>
  <hr />
	<a name="functionsession_is_valid"></a>
	<h3>session_is_valid <span class="smalllinenumber">[line 140]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>bool session_is_valid(
string $session_id, [bool $no_escape = FALSE])</code>
    </td></tr></table>
    </td></tr></table><br />

		Check whether a session is valid (i.e. sessin exist and not expired).<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td><strong>TRUE</strong> if valid, <strong>FALSE</strong> if not.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    		<h4>Parameters</h4>
    <table border="0" cellspacing="0" cellpadding="0">
		      <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$session_id</b>&nbsp;&nbsp;</td>
        <td>ID of session in question.</td>
      </tr>
		      <tr>
        <td class="type">bool&nbsp;&nbsp;</td>
        <td><b>$no_escape</b>&nbsp;&nbsp;</td>
        <td>Indicate whether to escape the variables or not.</td>
      </tr>
				</table>
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>
  <hr />
	<a name="functionsession_postpone_expiry"></a>
	<h3>session_postpone_expiry <span class="smalllinenumber">[line 170]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>bool session_postpone_expiry(
string $session_id, [string $postpone_time = SITE_DEFAULT_LOGIN_EXPIRE_TIME], [bool $no_escape = FALSE])</code>
    </td></tr></table>
    </td></tr></table><br />

		Postpone the expiry time of a session.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td><strong>TRUE</strong> if successed, <strong>FALSE</strong> if failed.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    		<h4>Parameters</h4>
    <table border="0" cellspacing="0" cellpadding="0">
		      <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$session_id</b>&nbsp;&nbsp;</td>
        <td>ID of session to be postponed.</td>
      </tr>
		      <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$postpone_time</b>&nbsp;&nbsp;</td>
        <td>Time to postone.(Default: SITE_DEFAULT_LOGIN_EXPIRE_TIME)</td>
      </tr>
		      <tr>
        <td class="type">bool&nbsp;&nbsp;</td>
        <td><b>$no_escape</b>&nbsp;&nbsp;</td>
        <td>Indicate whether to escape the variables or not.</td>
      </tr>
				</table>
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>
  <hr />
	<a name="functionsession_set"></a>
	<h3>session_set <span class="smalllinenumber">[line 69]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>bool session_set(
int $user_id, [string $session_id = FALSE], [bool $no_escape = FALSE])</code>
    </td></tr></table>
    </td></tr></table><br />

		Set a session of a user in database.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td><strong>TRUE</strong> if successed, <strong>FALSE</strong> if failed.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    		<h4>Parameters</h4>
    <table border="0" cellspacing="0" cellpadding="0">
		      <tr>
        <td class="type">int&nbsp;&nbsp;</td>
        <td><b>$user_id</b>&nbsp;&nbsp;</td>
        <td>User ID of the user.</td>
      </tr>
		      <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$session_id</b>&nbsp;&nbsp;</td>
        <td>Session ID to be set.(Default: generate automatically)</td>
      </tr>
		      <tr>
        <td class="type">bool&nbsp;&nbsp;</td>
        <td><b>$no_escape</b>&nbsp;&nbsp;</td>
        <td>Indicate whether to escape the variables or not.</td>
      </tr>
				</table>
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>
  <hr />
	<a name="functionsession_update_heartbeat"></a>
	<h3>session_update_heartbeat <span class="smalllinenumber">[line 106]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>bool session_update_heartbeat(
string $session_id, [bool $no_escape = FALSE])</code>
    </td></tr></table>
    </td></tr></table><br />

		Update the last heartbeat of a session.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td><strong>TRUE</strong> if successed, <strong>FALSE</strong> if failed.</td>
  </tr>
</table>
</div>
    <br /><br />
	
    		<h4>Parameters</h4>
    <table border="0" cellspacing="0" cellpadding="0">
		      <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$session_id</b>&nbsp;&nbsp;</td>
        <td>ID of session to be updated.</td>
      </tr>
		      <tr>
        <td class="type">bool&nbsp;&nbsp;</td>
        <td><b>$no_escape</b>&nbsp;&nbsp;</td>
        <td>Indicate whether to escape the variables or not.</td>
      </tr>
				</table>
    	<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
	</div>

        <div class="credit">
		    <hr />
		    Documentation generated on Fri, 06 May 2011 03:43:25 +0000 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>